package activeQM;


import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

import org.apache.activemq.command.ActiveMQObjectMessage;

import skeleton.IGestionRemota;
import contenedorSpring.Contenedor;
import core.coreEventoMouseCompartido;

public class ClienteQMColaServidorEventoMouse implements MessageListener {
	
	public ClienteQMColaServidorEventoMouse() {
		super();
	}

	
	@Override
	public void onMessage(Message m) {
		ActiveMQObjectMessage om = (ActiveMQObjectMessage) m;
			try {
				coreEventoMouseCompartido evento =  (coreEventoMouseCompartido) om.getObject();
				IGestionRemota g = (IGestionRemota) Contenedor.getSingleton().getApplicationContext().getBean("ServidorRMI");
				g.enviarEventoMouse(evento.getEvento(), evento.getViewer(), evento.getIp());
			} catch (JMSException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
	}
}
